package leetcode10;

import java.util.ArrayList;
import java.util.List;

public class test52 {
    /**
     * 78. 子集s
     */
    List<List<Integer>> list = new ArrayList<>();
    List<Integer> path = new ArrayList<>();
    public List<List<Integer>> subsets(int[] nums) {
        subsetsHelper(nums,0);
        return list;
    }
    public void subsetsHelper(int[] nums,int index){
        int size = nums.length;
        list.add(new ArrayList<>(path));
        for(int i = index;i < size;i++){
            path.add(nums[i]);
            subsetsHelper(nums,i + 1);
            path.removeLast();
        }
    }
}
